using Jupiter.Infrastructure.Permission.Attributes;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using Wips.AppService.Authorities.Permissions.Requests;

namespace Wips.MainServer.Controllers.Authorities
{
    /// <summary>
    /// 权限
    /// </summary>
    public class PermissionController : CustomeBaseController
    {
        #region 基础接口

        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="mediator"></param>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        [Permission]
        public async Task<bool> SaveAsync(
            [FromServices] IMediator mediator,
            [FromBody] SavePermissionRequest request
        )
        {
            return await mediator.Send(request);
        }

        #endregion
    }
}